<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子4-JS进阶（一）</title>
    </head>
    <body>
        <pre>
            <code>
                    // 例子4

                    var color = 'blue';

                    function changeColor() {
                        var anotherColor = 'red';

                        function swapColors() {
                            var tempColor = anotherColor;
                            anotherColor = color;
                            color = tempColor;
                        }

                        swapColors();
                    }

                    changeColor();
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/4.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>
</html>